﻿@model IEnumerable<PresentationLayer.Models.BookModel>

@{
    Layout = null;
}


<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="@Url.Content("~/Content/Table.css")" rel="stylesheet" type="text/css" />
    <title>Books</title>
</head>
<body>
    <p>
        @Html.ActionLink("Create New", "Create")
    </p>
    <div class="CSSTableGenerator">
    <table id="bookDetailsTbl">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AuthorName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Genre)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AuthorName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Genre)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                    @Ajax.ActionLink("Delete", "Delete", new { id = item.Id }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "bookDetailsTbl" })
                </td>
            </tr>
        }

    </table>
        </div>
</body>
</html>
